NETWORKING AND COMMUNICATIONS
GOALS FOR THE WEEK
- Send a message between two projects.
- design, build, and connect wired or wireless node(s) with network or bus addresses.
GROUP
INDIVIDUAL
Link to the group assignment: TEST
I2C
I2C (Inter-Integrated Circuit Bus), also commonly known as TWI (Two Wire Interface), is a two-wire synchronous serial bus cable.
- Use two cables. SDA (serial data) and SCL (serial clock). Each line has a pull-up resistance between the line and the positive rail. A good pull-up resistor is 1-10K ohms.
- It is a synchronous communication: this means that the data transfer is synchronized through a clock signal, generated by the master, which is present in all the connected devices.
- Serial: Serial transferred data means that a single bit is transferred at a time over a single cable.
- Bus: A bus is a system that allows many devices to communicate with each other through a single set of cables. They use an addressing system, in which each device has a unique address.
THE CONCEPT
This week Edu and I decided to work together. We designed a board together and milled, stuffed and programmed our end of the boards.
Link to his documentation.
TESTING WITH ARDUINO
We wanted first test out the concept using arduinos and a breadboard. We had one connected to each of our computers and a breadbaord inbetween. After making the connections and adding the resistors on SDL and SCL, there was initially no communication. We eventually realised that we forget to connect their GND's. After fixing that, the boards worked perfectly and we had our proof of concept!
SCHEMATIC
- The design has 2 boards, a master and a slave connected with 2 cables and ground.
- According to the datasheet, we had to used pins PA14 and PA15
- Both lines need pull up resistors.
PROGRAMMING
We worked on a simple Hide and seek game,
- My board takes up Address 8.
- RequestEvent executes whenever data is requested by the master.
- Instead of opening the connection during startup, we roate and change addresses once every loop(). This makes the baord change and hide behind a different address.
- Both boards need to agree on the range of addresses where they will play (1 to 50).
- The detection algorithm is pseudo-random.
EXECUTION
Design files download
Arduino for test 1
Arduino for test 2